********************************************************************************************************************************
***   Replication file for:                                                                                                  ***
***   Berbee, P., Braun, S. T. and Franke, R. (2024). Reversing Fortunes of German Regions, 1926-2019. JoEG.			     ***
***   							                                                                                             ***
***   SCRIPT: 	_x3b_preparation_turnover_1935.do																			 ***	
***   PURPOSE: 	Reads in and prepares trunover data from 1935															 	 ***
********************************************************************************************************************************

* Preamble (unnecessary when executing run.do)
run "$reversing/scripts/programs/_config.do"

************
* Code begins
************

*** Import data on population 1939
import excel "$reversing/data/Population_1939.xlsx", sheet("Data") firstrow clear

* Rename 
rename pop population
rename Sheet1__La labor_market_id

*** Save data
keep labor_market_id population
sort labor_market_id

save "$reversing/processed/intermediate/population1939.dta",replace


*** Import data
import excel "$reversing/data/turnover1935.xlsx", sheet("Data") firstrow clear

* Rename and create matching variables

gen turnover=in_u
rename Sheet1__La labor_market_id

* Merge with 1939 population data (as we don't have population data for 1935)
merge 1:1 labor_market_id using "$reversing/processed/intermediate/population1939.dta"

gen year=1935

*** Save data
keep labor_market_id turnover population year
destring labor_market_id, replace
sort labor_market_id

save "$reversing/processed/intermediate/turnover1935.dta",replace

*** EOF

